import { Dropdown as AntDropdown } from 'antd';
import React from 'react';
import { useConfig } from '../ConfigProvider';
import DropdownItem from './DropdownItem';
import { DropdownComponent, DropdownProps } from './interface';
import './style.less';

const Dropdown = ((props) => {
  const { antNative, children, ...restProps } = props;
  const { antNative: globalAntNative } = useConfig();

  if (antNative || globalAntNative) {
    return <AntDropdown {...restProps}>{children}</AntDropdown>;
  }

  return <AntDropdown {...restProps}>{children}</AntDropdown>;
}) as DropdownComponent;

Dropdown.Item = DropdownItem;

export default Dropdown; 